package com.ssy.lingxi.purchase.serviceimpl.tender;

import com.ssy.lingxi.common.model.vo.PageVO;
import com.ssy.lingxi.purchase.entity.tender.SubmitTenderMateriel;
import com.ssy.lingxi.purchase.repository.tender.SubmitTenderMaterielRepository;
import com.ssy.lingxi.purchase.service.tender.ISubmitTenderMaterielService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 投标实现类
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/3/1
 */
@Service
public class SubmitTenderMaterielServiceImpl implements ISubmitTenderMaterielService {

    @Resource
    private SubmitTenderMaterielRepository submitTenderMaterielRepository;

    /**
     * 查询投标列表
     * @param pageVO
     * @param submitTenderId
     * @return
     */
    @Override
    public Page<SubmitTenderMateriel> getSubmitTenderMaterielList(PageVO pageVO, Long submitTenderId, Boolean isAwardTender) {
        Pageable page = PageRequest.of(pageVO.getCurrent() - 1, pageVO.getPageSize());
        return submitTenderMaterielRepository.findBySubmitTenderIdAndIsAwardTender(submitTenderId, isAwardTender, page);
    }

}

